﻿<ResourceDictionary x:Class="WpfRcp.Controls.Themes.Generic"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:Controls2="clr-namespace:WpfRcp.Controls">

    <Controls2:ChromeWindowUpperCornerRadiusValueConverter x:Key="chromeWindowUpperCornerRadiusValueConverter" />
    <Controls2:NumericSpinnerValueConverter x:Key="numericSpinnerValueConverter" />

    <!--Converter for Indentation of items-->
    <Controls2:TreeListViewConverter x:Key="TreeListViewConverter" />

    <!-- Label TextBox -->
    <Style x:Key="textBoxStyle" TargetType="TextBox">
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Margin" Value="1" />
    </Style>

    <Style x:Key="labelStyle" TargetType="Label">
        <Setter Property="Margin" Value="-3" />
    </Style>

    <Style TargetType="{x:Type Controls2:LabelTextBox}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls2:LabelTextBox}">
                    <Grid>
                        <Rectangle RadiusX="0" RadiusY="0" Fill="{TemplateBinding Background}"
                                Stroke="{TemplateBinding Foreground}" StrokeThickness="1" />
                        <Label x:Name="PART_Label" Foreground="{TemplateBinding Foreground}"
                                Content="{TemplateBinding Text}" Style="{StaticResource labelStyle}" />
                        <TextBox x:Name="PART_TextBox" Style="{StaticResource textBoxStyle}" Visibility="Collapsed" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEdited" Value="true">
                            <Setter TargetName="PART_TextBox" Property="Visibility" Value="Visible" />
                            <Setter TargetName="PART_Label" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--RegexTextBox-->
    <Style TargetType="{x:Type Controls2:RegexTextBox}">
        <Setter Property="Foreground" Value="{DynamicResource TextBoxForegroundKey}" />
        <Setter Property="Background" Value="{DynamicResource TextBoxBackgroundKey}" />
        <Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderKey}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Padding" Value="1" />
        <Setter Property="AllowDrop" Value="True" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBoxBase}">
                    <Border BorderThickness="{TemplateBinding BorderThickness}"
                            BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}"
                            CornerRadius="4" SnapsToDevicePixels="True">
                        <ScrollViewer x:Name="PART_ContentHost"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                            <Setter Property="Background" Value="{DynamicResource TextBoxDisabledBackgroundKey}" />
                            <Setter Property="BorderBrush" Value="{DynamicResource TextBoxDisabledBorderKey}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--WIZARD CONTROL-->
    <Controls2:NavigationMultiConverter x:Key="navigationMultiConverter" />

    <Style TargetType="Border" x:Key="{x:Static Controls2:Wizard.HeaderPanelBorderResourceKey}">
        <Setter Property="Background" Value="#FFFFFF" />
        <Setter Property="BorderBrush" Value="#A0A0A0" />
        <Setter Property="BorderThickness" Value="0,0,0,1" />
        <Setter Property="Padding" Value="5" />
    </Style>

    <Style TargetType="Border" x:Key="{x:Static Controls2:Wizard.SideHeaderPanelBorderResourceKey}">
        <Setter Property="Background" Value="#FFFFFF" />
        <Setter Property="BorderBrush" Value="#A0A0A0" />
        <Setter Property="BorderThickness" Value="0,0,1,0" />
    </Style>

    <Style TargetType="Border" x:Key="{x:Static Controls2:Wizard.ContentPanelBorderResourceKey}">
        <Setter Property="Background" Value="#FFFFFF" />
    </Style>

    <Style TargetType="Border" x:Key="{x:Static Controls2:Wizard.NavigationPanelBorderResourceKey}">
        <Setter Property="Background" Value="#F0F0F0" />
        <Setter Property="BorderBrush" Value="#A0A0A0" />
        <Setter Property="BorderThickness" Value="0,1,0,0" />
        <Setter Property="Padding" Value="7" />
    </Style>

    <Style TargetType="Button" x:Key="{x:Static Controls2:Wizard.NavigationButtonResourceKey}">
        <Setter Property="Width" Value="76" />
        <Setter Property="Height" Value="24" />
    </Style>

    <Style TargetType="{x:Type Controls2:Wizard}">
        <Setter Property="Background" Value="#F0F0F0" />
        <Setter Property="BorderBrush" Value="#A0A0A0" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls2:Wizard}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid>

                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>

                            <ContentPresenter Grid.Row="0"
                                              Content="{Binding RelativeSource={x:Static RelativeSource.TemplatedParent}, Path=SelectedItem}"
                                              Margin="{TemplateBinding Padding}" />

                            <!--WIZARD NAVIGATION-->
                            <Border Grid.Row="1" Style="{DynamicResource {ComponentResourceKey ResourceId=NavigationPanelBorderResourceKey, TypeInTargetAssembly={x:Type Controls2:Wizard}}}">
                                <Grid>
                                    <Button x:Name="PART_Help" HorizontalAlignment="Left" Content="{DynamicResource helpString}"
                                        Style="{DynamicResource {ComponentResourceKey ResourceId=NavigationButtonResourceKey, TypeInTargetAssembly={x:Type Controls2:Wizard}}}"
                                        IsEnabled="{Binding RelativeSource={x:Static RelativeSource.TemplatedParent}, Path=SelectedItem.CanHelp}"></Button>

                                    <StackPanel Height="26" Orientation="Horizontal" HorizontalAlignment="Right">
                                        <Button x:Name="PART_Cancel" Content="{DynamicResource cancelString}" Margin="0,0,7,0"
                                            Style="{DynamicResource {ComponentResourceKey ResourceId=NavigationButtonResourceKey, TypeInTargetAssembly={x:Type Controls2:Wizard}}}"
                                            IsEnabled="{Binding RelativeSource={x:Static RelativeSource.TemplatedParent}, Path=SelectedItem.CanCancel}"></Button>
                                        <Button x:Name="PART_Previous" Content="{DynamicResource previousString}" Style="{DynamicResource {ComponentResourceKey ResourceId=NavigationButtonResourceKey, TypeInTargetAssembly={x:Type Controls2:Wizard}}}">
                                            <Button.IsEnabled>
                                                <MultiBinding Converter="{StaticResource navigationMultiConverter}">
                                                    <Binding RelativeSource="{x:Static RelativeSource.TemplatedParent}" Path="SelectedItem.CanNavigatePrevious" />
                                                    <Binding RelativeSource="{x:Static RelativeSource.TemplatedParent}" Path="SelectedItem.CanPrevious" />
                                                </MultiBinding>
                                            </Button.IsEnabled>
                                        </Button>
                                        <Button x:Name="PART_Next" Content="{DynamicResource nextString}" Style="{DynamicResource {ComponentResourceKey ResourceId=NavigationButtonResourceKey, TypeInTargetAssembly={x:Type Controls2:Wizard}}}">
                                            <Button.IsEnabled>
                                                <MultiBinding Converter="{StaticResource navigationMultiConverter}">
                                                    <Binding RelativeSource="{x:Static RelativeSource.TemplatedParent}" Path="SelectedItem.CanNavigateNext" />
                                                    <Binding RelativeSource="{x:Static RelativeSource.TemplatedParent}" Path="SelectedItem.CanNext" />
                                                </MultiBinding>
                                            </Button.IsEnabled>
                                        </Button>
                                        <Button x:Name="PART_Finish" Content="{DynamicResource finishString}" Margin="7,0,0,0"
                                            Style="{DynamicResource {ComponentResourceKey ResourceId=NavigationButtonResourceKey, TypeInTargetAssembly={x:Type Controls2:Wizard}}}"
                                            IsEnabled="{Binding RelativeSource={x:Static RelativeSource.TemplatedParent}, Path=SelectedItem.CanFinish}"></Button>
                                    </StackPanel>
                                </Grid>
                            </Border>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type Controls2:WizardPage}">
        <Setter Property="Background" Value="#F0F0F0" />
        <Setter Property="BorderBrush" Value="#A0A0A0" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls2:WizardPage}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid>

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>

                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>

                            <!--WIZARD HEADER-->
                            <Border x:Name="HeaderBorder" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="1"
                                    Style="{DynamicResource {ComponentResourceKey ResourceId=HeaderPanelBorderResourceKey, TypeInTargetAssembly={x:Type Controls2:Wizard}}}">
                                <ContentControl x:Name="HeaderPresenter" Content="{Binding RelativeSource={x:Static RelativeSource.TemplatedParent}, Path=Header}" />
                            </Border>

                            <!--WIZARD SIDE HEADER-->
                            <Border x:Name="SideHeaderBorder" Grid.Row="0" Grid.RowSpan="2" Grid.Column="0"
                                    Style="{DynamicResource {ComponentResourceKey ResourceId=SideHeaderPanelBorderResourceKey, TypeInTargetAssembly={x:Type Controls2:Wizard}}}">
                                <ContentControl x:Name="SideHeaderPresenter" Content="{Binding RelativeSource={x:Static RelativeSource.TemplatedParent}, Path=SideHeader}" />
                            </Border>

                            <!--WIZARD MAIN CONTENT-->
                            <Border Grid.Row="1" Grid.Column="1"
                                    Style="{DynamicResource {ComponentResourceKey ResourceId=ContentPanelBorderResourceKey, TypeInTargetAssembly={x:Type Controls2:Wizard}}}">
                                <ContentControl Content="{Binding RelativeSource={x:Static RelativeSource.TemplatedParent}, Path=Content}"
                                                Margin="{TemplateBinding Padding}" />
                            </Border>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <Trigger SourceName="SideHeaderPresenter" Property="HasContent" Value="False">
                            <Setter TargetName="SideHeaderBorder" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                        <Trigger SourceName="HeaderPresenter" Property="HasContent" Value="False">
                            <Setter TargetName="HeaderBorder" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!--END OF WIZARD CONTROL-->

    <!--Standard Expand Collapse Button, NOT USED-->
    <Style x:Key="ExpandCollapseToggleStyle2" TargetType="{x:Type ToggleButton}">
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Width="9" Height="9" BorderThickness="1" BorderBrush="#FF7898B5" CornerRadius="1"
                            SnapsToDevicePixels="true">
                        <Border.Background>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                                <LinearGradientBrush.GradientStops>
                                    <GradientStop Color="White" Offset=".2" />
                                    <GradientStop Color="#FFC0B7A6" Offset="1" />
                                </LinearGradientBrush.GradientStops>
                            </LinearGradientBrush>
                        </Border.Background>
                        <Path x:Name="ExpandPath" Margin="1,1,1,1" Fill="Black"
                                Data="M 0 2 L 0 3 L 2 3 L 2 5 L 3 5 L 3 3 L 5 3 L 5 2 L 3 2 L 3 0 L 2 0 L 2 2 Z" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter Property="Data" TargetName="ExpandPath" Value="M 0 2 L 0 3 L 5 3 L 5 2 Z" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ExpandCollapseToggleStyle" TargetType="ToggleButton">
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToggleButton">
                    <Grid Width="15" Height="13" Background="Transparent">
                        <Path x:Name="ExpandPath" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="1,1,1,1"
                                Fill="{DynamicResource GridViewForeground}" Data="M 4 0 L 8 4 L 4 8 Z" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter Property="Data" TargetName="ExpandPath" Value="M 0 4 L 8 4 L 4 8 Z" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate TargetType="TreeViewItem" x:Key="TreeListViewItem">
        <StackPanel>
            <Border x:Name="FocusArea" BorderThickness="1" CornerRadius="2" SnapsToDevicePixels="true"
                    Background="Transparent">
                <Border Name="InnerBorder" CornerRadius="1" BorderThickness="1">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition MaxHeight="11" />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Rectangle Name="UpperHighlight" Visibility="Collapsed" Fill="#75FFFFFF" />

                        <GridViewRowPresenter x:Name="PART_Header" Grid.RowSpan="2" Content="{TemplateBinding Header}" Columns="{Binding Columns, 
                            RelativeSource={RelativeSource Mode=FindAncestor, 
                            AncestorType=Controls2:TreeListView}}" />
                    </Grid>
                </Border>
            </Border>
            <ItemsPresenter x:Name="ItemsHost" />
        </StackPanel>
        <ControlTemplate.Triggers>
            <Trigger SourceName="FocusArea" Property="IsMouseOver" Value="true">
                <Setter TargetName="UpperHighlight" Property="Visibility" Value="Visible" />
                <Setter TargetName="InnerBorder" Property="BorderBrush" Value="#80FFFFFF" />
            </Trigger>
            <Trigger Property="IsSelected" Value="true">
                <Setter TargetName="InnerBorder" Property="BorderBrush" Value="#80FFFFFF" />
                <Setter TargetName="UpperHighlight" Property="Visibility" Value="Visible" />
                <Setter TargetName="UpperHighlight" Property="Fill" Value="#40FFFFFF" />
            </Trigger>
            <Trigger Property="IsExpanded" Value="false">
                <Setter TargetName="ItemsHost" Property="Visibility" Value="Collapsed" />
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="HasHeader" Value="false" />
                    <Condition Property="Width" Value="Auto" />
                </MultiTrigger.Conditions>
                <Setter TargetName="PART_Header" Property="MinWidth" Value="75" />
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="HasHeader" Value="false" />
                    <Condition Property="Height" Value="Auto" />
                </MultiTrigger.Conditions>
                <Setter TargetName="PART_Header" Property="MinHeight" Value="19" />
            </MultiTrigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="TreeListViewExpander">
        <StackPanel Orientation="Horizontal" x:Name="ContainerElement">
            <!--Use a FrameworkElement to indent the button-->
            <FrameworkElement
                    Width="{Binding RelativeSource={x:Static RelativeSource.Self}, Converter={StaticResource TreeListViewConverter}}" />

            <ToggleButton
                    IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=TreeViewItem}}"
                    VerticalAlignment="Center" Margin="1" Style="{StaticResource ExpandCollapseToggleStyle}"
                    Focusable="False" />
        </StackPanel>
        <ControlTemplate.Triggers>
            <DataTrigger
                    Binding="{Binding HasItems, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=TreeViewItem}}"
                    Value="False">
                <Setter TargetName="ContainerElement" Property="Visibility" Value="Hidden" />
            </DataTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="TreeListViewScrollViewer" TargetType="ScrollViewer">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ScrollViewer">
                    <Grid Background="{TemplateBinding Background}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <DockPanel Margin="{TemplateBinding Padding}">
                            <ScrollViewer DockPanel.Dock="Top" HorizontalScrollBarVisibility="Hidden"
                                    VerticalScrollBarVisibility="Hidden" Focusable="false">
                                <GridViewHeaderRowPresenter Margin="2,0,2,0"
                                        Columns="{Binding Path=TemplatedParent.Columns, RelativeSource={RelativeSource TemplatedParent}}"
                                        ColumnHeaderContainerStyle="{DynamicResource GridViewColumnHeaderStyle}"
                                        AllowsColumnReorder="{Binding Path=TemplatedParent.AllowsColumnReorder, RelativeSource={RelativeSource TemplatedParent}}" />
                            </ScrollViewer>

                            <ScrollContentPresenter Name="PART_ScrollContentPresenter"
                                    KeyboardNavigation.DirectionalNavigation="Local" CanContentScroll="True"
                                    CanHorizontallyScroll="False" CanVerticallyScroll="False" />
                        </DockPanel>

                        <ScrollBar Name="PART_HorizontalScrollBar" Orientation="Horizontal" Grid.Row="1"
                                Maximum="{TemplateBinding ScrollableWidth}"
                                ViewportSize="{TemplateBinding ViewportWidth}"
                                Value="{TemplateBinding HorizontalOffset}"
                                Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" />

                        <ScrollBar Name="PART_VerticalScrollBar" Grid.Column="1"
                                Maximum="{TemplateBinding ScrollableHeight}"
                                ViewportSize="{TemplateBinding ViewportHeight}" Value="{TemplateBinding VerticalOffset}"
                                Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type Controls2:TreeListView}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls2:TreeListView}">
                    <ControlTemplate.Resources>
                        <Style TargetType="TreeViewItem">
                            <Setter Property="Foreground" Value="{DynamicResource GridViewForeground}" />
                            <Setter Property="Template" Value="{StaticResource TreeListViewItem}" />
                            <EventSetter Event="PreviewMouseRightButtonDown"
                                    Handler="OnTreeListViewItemPreviewMouseRightButtonDown" />
                        </Style>
                        <Style TargetType="Controls2:TreeListViewExpander">
                            <Setter Property="Template" Value="{StaticResource TreeListViewExpander}" />
                        </Style>
                    </ControlTemplate.Resources>
                    <Border Background="{TemplateBinding Background}" CornerRadius="4"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <ScrollViewer Style="{StaticResource TreeListViewScrollViewer}" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
                            <ItemsPresenter />
                        </ScrollViewer>
                    </Border>

                    <!--<Border Background="{TemplateBinding Background}" CornerRadius="4"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        
                        <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>
                                
                                <GridViewHeaderRowPresenter Columns="{TemplateBinding Columns}"
                                        AllowsColumnReorder="{TemplateBinding AllowsColumnReorder}"
                                        ColumnHeaderContainerStyle="{DynamicResource GridViewColumnHeaderStyle}" />

                                <ScrollViewer HorizontalScrollBarVisibility="Disabled"
                                        VerticalScrollBarVisibility="Auto" Grid.Row="1">
                                    <ItemsPresenter />
                                </ScrollViewer>
                            </Grid>
                        </ScrollViewer>
                    </Border>-->
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--TRANSPARENT THUMB-->
    <Style x:Key="TransparentThumbStyle" TargetType="{x:Type Thumb}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Rectangle Fill="Transparent" Stroke="{x:Null}" StrokeThickness="0" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--CLOSE BUTTON-->
    <Style BasedOn="{StaticResource {x:Type Button}}" TargetType="Button" x:Key="CloseButtonKey">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid x:Name="grid" RenderTransformOrigin="0.5, 0.5">
                        <Grid.RenderTransform>
                            <ScaleTransform ScaleX="1" ScaleY="1" />
                        </Grid.RenderTransform>
                        <Image x:Name="image">
                            <Image.Source>                                
                                <DrawingImage>
                                    <DrawingImage.Drawing>
                                        <DrawingGroup>
                                            <DrawingGroup.Children>
                                                <GeometryDrawing Brush="#FFBD0000" Geometry="F1 M 80,5.00006L 346,5.00006C 387.421,5.00006 421,38.5787 421,80L 421,346C 421,387.421 387.421,421 346,421L 80,421C 38.5786,421 5,387.421 5,346L 5,80C 5,38.5787 38.5786,5.00006 80,5.00006 Z ">
                                                    <GeometryDrawing.Pen>
                                                        <Pen Thickness="10" LineJoin="Round" Brush="#FF000000"/>
                                                    </GeometryDrawing.Pen>
                                                </GeometryDrawing>
                                                <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 101,101L 325,325">
                                                    <GeometryDrawing.Pen>
                                                        <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                    </GeometryDrawing.Pen>
                                                </GeometryDrawing>
                                                <GeometryDrawing Brush="#FFEF1414" Geometry="F1 M 101,325L 325,101">
                                                    <GeometryDrawing.Pen>
                                                        <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                    </GeometryDrawing.Pen>
                                                </GeometryDrawing>
                                            </DrawingGroup.Children>
                                        </DrawingGroup>
                                    </DrawingImage.Drawing>
                                </DrawingImage>
                            </Image.Source>
                        </Image>
                    </Grid>                    

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="1.1" Duration="00:00:00.1" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="1.1" Duration="00:00:00.1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="1.0" Duration="00:00:00.1" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="1.0" Duration="00:00:00.1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>

                            <Setter TargetName="image" Property="Source">
                                <Setter.Value>
                                    <DrawingImage>
                                        <DrawingImage.Drawing>
                                            <DrawingGroup>
                                                <DrawingGroup.Children>
                                                    <GeometryDrawing Brush="#FFFF0000" Geometry="F1 M 80,5.00006L 346,5.00006C 387.421,5.00006 421,38.5787 421,80L 421,346C 421,387.421 387.421,421 346,421L 80,421C 38.5786,421 5,387.421 5,346L 5,80C 5,38.5787 38.5786,5.00006 80,5.00006 Z ">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="10" LineJoin="Round" Brush="#FF000000"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 101,101L 325,325">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FFEF1414" Geometry="F1 M 101,325L 325,101">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                </DrawingGroup.Children>
                                            </DrawingGroup>
                                        </DrawingImage.Drawing>
                                    </DrawingImage>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">

                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>                                        
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="0.9" Duration="00:00:00.1" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="0.9" Duration="00:00:00.1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="1.0" Duration="00:00:00.1" FillBehavior="Stop" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="1.0" Duration="00:00:00.1" FillBehavior="Stop" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>

                            <Setter TargetName="image" Property="Source">
                                <Setter.Value>
                                    <DrawingImage>
                                        <DrawingImage.Drawing>
                                            <DrawingGroup>
                                                <DrawingGroup.Children>
                                                    <GeometryDrawing Brush="#FF710505" Geometry="F1 M 80,5.00006L 346,5.00006C 387.421,5.00006 421,38.5787 421,80L 421,346C 421,387.421 387.421,421 346,421L 80,421C 38.5786,421 5,387.421 5,346L 5,80C 5,38.5787 38.5786,5.00006 80,5.00006 Z ">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="10" LineJoin="Round" Brush="#FF000000"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 101,101L 325,325">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FFEF1414" Geometry="F1 M 101,325L 325,101">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                </DrawingGroup.Children>
                                            </DrawingGroup>
                                        </DrawingImage.Drawing>
                                    </DrawingImage>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--MAXIMIZE BUTTON-->
    <Style BasedOn="{StaticResource {x:Type Button}}" TargetType="Button" x:Key="MaximizeButtonKey">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">

                    <Grid x:Name="grid" RenderTransformOrigin="0.5, 0.5">
                        <Grid.RenderTransform>
                            <ScaleTransform ScaleX="1" ScaleY="1" />
                        </Grid.RenderTransform>
                        <Image x:Name="image">
                            <Image.Source>
                                <DrawingImage>
                                    <DrawingImage.Drawing>
                                        <DrawingGroup>
                                            <DrawingGroup.Children>
                                                <GeometryDrawing Brush="#FF464646" Geometry="F1 M 80,5L 346,5C 387.421,5 421,38.5786 421,80L 421,346C 421,387.421 387.421,421 346,421L 80,421C 38.5786,421 5,387.421 5,346L 5,80C 5,38.5786 38.5786,5 80,5 Z ">
                                                    <GeometryDrawing.Pen>
                                                        <Pen Thickness="10" LineJoin="Round" Brush="#FF000000"/>
                                                    </GeometryDrawing.Pen>
                                                </GeometryDrawing>
                                                <GeometryDrawing Brush="#FF464646" Geometry="F1 M 101,101L 325,101L 325,325L 101,325L 101,101 Z ">
                                                    <GeometryDrawing.Pen>
                                                        <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                    </GeometryDrawing.Pen>
                                                </GeometryDrawing>
                                            </DrawingGroup.Children>
                                        </DrawingGroup>
                                    </DrawingImage.Drawing>
                                </DrawingImage>
                            </Image.Source>
                        </Image>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="1.1" Duration="00:00:00.1" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="1.1" Duration="00:00:00.1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="1.0" Duration="00:00:00.1" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="1.0" Duration="00:00:00.1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>

                            <Setter TargetName="image" Property="Source">
                                <Setter.Value>
                                    <DrawingImage>
                                        <DrawingImage.Drawing>
                                            <DrawingGroup>
                                                <DrawingGroup.Children>
                                                    <GeometryDrawing Brush="#FF545353" Geometry="F1 M 80,5L 346,5C 387.421,5 421,38.5786 421,80L 421,346C 421,387.421 387.421,421 346,421L 80,421C 38.5786,421 5,387.421 5,346L 5,80C 5,38.5786 38.5786,5 80,5 Z ">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="10" LineJoin="Round" Brush="#FF000000"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FF545353" Geometry="F1 M 101,101L 325,101L 325,325L 101,325L 101,101 Z ">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                </DrawingGroup.Children>
                                            </DrawingGroup>
                                        </DrawingImage.Drawing>
                                    </DrawingImage>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">

                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="0.9" Duration="00:00:00.1" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="0.9" Duration="00:00:00.1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="1.0" Duration="00:00:00.1" FillBehavior="Stop" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="1.0" Duration="00:00:00.1" FillBehavior="Stop" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>

                            <Setter TargetName="image" Property="Source">
                                <Setter.Value>
                                    <DrawingImage>
                                        <DrawingImage.Drawing>
                                            <DrawingGroup>
                                                <DrawingGroup.Children>
                                                    <GeometryDrawing Brush="#FF212020" Geometry="F1 M 80,5L 346,5C 387.421,5 421,38.5786 421,80L 421,346C 421,387.421 387.421,421 346,421L 80,421C 38.5786,421 5,387.421 5,346L 5,80C 5,38.5786 38.5786,5 80,5 Z ">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="10" LineJoin="Round" Brush="#FF000000"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FF212020" Geometry="F1 M 101,101L 325,101L 325,325L 101,325L 101,101 Z ">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                </DrawingGroup.Children>
                                            </DrawingGroup>
                                        </DrawingImage.Drawing>
                                    </DrawingImage>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--MINIMIZE BUTTON-->
    <Style BasedOn="{StaticResource {x:Type Button}}" TargetType="Button" x:Key="MinimizeButtonKey">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">

                    <Grid x:Name="grid" RenderTransformOrigin="0.5, 0.5">
                        <Grid.RenderTransform>
                            <ScaleTransform ScaleX="1" ScaleY="1" />
                        </Grid.RenderTransform>
                        <Image x:Name="image">
                            <Image.Source>
                                <DrawingImage>
                                    <DrawingImage.Drawing>
                                        <DrawingGroup>
                                            <DrawingGroup.Children>
                                                <GeometryDrawing Brush="#FF464646" Geometry="F1 M 80,5L 346,5C 387.421,5 421,38.5786 421,80L 421,346C 421,387.421 387.421,421 346,421L 80,421C 38.5786,421 5,387.421 5,346L 5,80C 5,38.5786 38.5786,5 80,5 Z ">
                                                    <GeometryDrawing.Pen>
                                                        <Pen Thickness="10" LineJoin="Round" Brush="#FF000000"/>
                                                    </GeometryDrawing.Pen>
                                                </GeometryDrawing>
                                                <GeometryDrawing Brush="#FF0000BD" Geometry="F1 M 101,293L 325,293L 325,325L 101,325L 101,293 Z ">
                                                    <GeometryDrawing.Pen>
                                                        <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                    </GeometryDrawing.Pen>
                                                </GeometryDrawing>
                                            </DrawingGroup.Children>
                                        </DrawingGroup>
                                    </DrawingImage.Drawing>
                                </DrawingImage>
                            </Image.Source>
                        </Image>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="1.1" Duration="00:00:00.1" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="1.1" Duration="00:00:00.1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="1.0" Duration="00:00:00.1" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="1.0" Duration="00:00:00.1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>

                            <Setter TargetName="image" Property="Source">
                                <Setter.Value>
                                    <DrawingImage>
                                        <DrawingImage.Drawing>
                                            <DrawingGroup>
                                                <DrawingGroup.Children>
                                                    <GeometryDrawing Brush="#FF545353" Geometry="F1 M 80,5L 346,5C 387.421,5 421,38.5786 421,80L 421,346C 421,387.421 387.421,421 346,421L 80,421C 38.5786,421 5,387.421 5,346L 5,80C 5,38.5786 38.5786,5 80,5 Z ">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="10" LineJoin="Round" Brush="#FF000000"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FF0000BD" Geometry="F1 M 101,293L 325,293L 325,325L 101,325L 101,293 Z ">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                </DrawingGroup.Children>
                                            </DrawingGroup>
                                        </DrawingImage.Drawing>
                                    </DrawingImage>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">

                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="0.9" Duration="00:00:00.1" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="0.9" Duration="00:00:00.1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="1.0" Duration="00:00:00.1" FillBehavior="Stop" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="1.0" Duration="00:00:00.1" FillBehavior="Stop" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>

                            <Setter TargetName="image" Property="Source">
                                <Setter.Value>
                                    <DrawingImage>
                                        <DrawingImage.Drawing>
                                            <DrawingGroup>
                                                <DrawingGroup.Children>
                                                    <GeometryDrawing Brush="#FF212020" Geometry="F1 M 80,5L 346,5C 387.421,5 421,38.5786 421,80L 421,346C 421,387.421 387.421,421 346,421L 80,421C 38.5786,421 5,387.421 5,346L 5,80C 5,38.5786 38.5786,5 80,5 Z ">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="10" LineJoin="Round" Brush="#FF000000"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FF0000BD" Geometry="F1 M 101,293L 325,293L 325,325L 101,325L 101,293 Z ">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                </DrawingGroup.Children>
                                            </DrawingGroup>
                                        </DrawingImage.Drawing>
                                    </DrawingImage>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--CHROME WINDOW-->
    <SolidColorBrush Color="#636363" x:Key="UpperChromeRectangleColorKey" />
    <SolidColorBrush Color="#595959" x:Key="LowerChromeRectangleColorKey" />
    <SolidColorBrush Color="White" x:Key="ChromeTitleColorKey" />

    <ControlTemplate TargetType="{x:Type Controls2:ChromeWindow}" x:Key="WindowWithChromeKey">
        <Border Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}"
                CornerRadius="{TemplateBinding BorderCornerRadius}">

            <DockPanel>
                <Grid DockPanel.Dock="Top" Height="30" VerticalAlignment="Top">

                    <Border Background="{StaticResource UpperChromeRectangleColorKey}"
                            Height="15" VerticalAlignment="Top"
                            CornerRadius="{Binding Path=BorderCornerRadius, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource chromeWindowUpperCornerRadiusValueConverter}}" />
                    <Rectangle Stretch="Fill" Fill="{StaticResource LowerChromeRectangleColorKey}" Margin="0,0,0,0"
                            Height="15" VerticalAlignment="Bottom" />
                    <Label Content="{TemplateBinding Title}" Foreground="{StaticResource ChromeTitleColorKey}"
                            FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0" />
                    <Thumb Opacity="0" x:Name="PART_ChromeThumb" />

                    <Button x:Name="PART_Close" Style="{StaticResource CloseButtonKey}" Margin="0,0,10,0" Width="16"
                            Height="16" HorizontalAlignment="Right" />
                </Grid>

                <AdornerDecorator>
                    <ContentPresenter Margin="{TemplateBinding Margin}" />
                </AdornerDecorator>

            </DockPanel>
        </Border>
    </ControlTemplate>
    
    <ControlTemplate TargetType="{x:Type Controls2:ChromeWindow}" x:Key="WindowWithChromeNoneKey">
        <Border Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}"
                CornerRadius="{TemplateBinding BorderCornerRadius}">

            <DockPanel>
                <Grid DockPanel.Dock="Top" Height="30" VerticalAlignment="Top">

                    <Border Background="{StaticResource UpperChromeRectangleColorKey}"
                            Height="15" VerticalAlignment="Top"
                            CornerRadius="{Binding Path=BorderCornerRadius, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource chromeWindowUpperCornerRadiusValueConverter}}" />
                    <Rectangle Stretch="Fill" Fill="{StaticResource LowerChromeRectangleColorKey}" Margin="0,0,0,0"
                            Height="15" VerticalAlignment="Bottom" />
                    <Label Content="{TemplateBinding Title}" Foreground="{StaticResource ChromeTitleColorKey}"
                            FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0" />
                    <Thumb Opacity="0" x:Name="PART_ChromeThumb" />
                </Grid>

                <AdornerDecorator>
                    <ContentPresenter Margin="{TemplateBinding Margin}" />
                </AdornerDecorator>

            </DockPanel>
        </Border>
    </ControlTemplate>

    <ControlTemplate TargetType="{x:Type Controls2:ChromeWindow}" x:Key="ResizableWindowWithChromeKey">
        <Border Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}"
                CornerRadius="{TemplateBinding BorderCornerRadius}" ClipToBounds="True">

            <DockPanel>
                <Grid DockPanel.Dock="Top" Height="30" VerticalAlignment="Top">

                    <Border Background="{StaticResource UpperChromeRectangleColorKey}"
                            Height="15" VerticalAlignment="Top"
                            CornerRadius="{Binding Path=BorderCornerRadius, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource chromeWindowUpperCornerRadiusValueConverter}}" />
                    <Rectangle Stretch="Fill" Fill="{StaticResource LowerChromeRectangleColorKey}"
                            Height="15" VerticalAlignment="Bottom" />
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
                        <Image x:Name="IconImage" Source="{TemplateBinding Icon}" Width="16" Height="16"
                                Margin="5,0,0,0" />
                        <Label Content="{TemplateBinding Title}" Foreground="{StaticResource ChromeTitleColorKey}"
                                FontWeight="Bold" />
                    </StackPanel>
                    <Thumb Opacity="0" x:Name="PART_ChromeThumb" />

                    <Button x:Name="PART_Minimize" Style="{StaticResource MinimizeButtonKey}" Margin="0,0,50,0"
                            Width="16" Height="16" HorizontalAlignment="Right" />
                    <Button x:Name="PART_Maximize" Style="{StaticResource MaximizeButtonKey}" Margin="0,0,30,0"
                            Width="16" Height="16" HorizontalAlignment="Right" />
                    <Button x:Name="PART_Close" Style="{StaticResource CloseButtonKey}" Margin="0,0,10,0" Width="16"
                            Height="16" HorizontalAlignment="Right" />

                    <Thumb HorizontalAlignment="Right" VerticalAlignment="Stretch" Opacity="0"
                            Tag="{x:Static Controls2:ResizeEdges.Right}" Margin="0,0,0,0" Width="6" Cursor="SizeWE" />
                    <Thumb HorizontalAlignment="Left" VerticalAlignment="Stretch" Opacity="0"
                            Tag="{x:Static Controls2:ResizeEdges.Left}" Margin="0,0,0,0" Width="6" Cursor="SizeWE" />
                    <Thumb HorizontalAlignment="Stretch" VerticalAlignment="Top" Opacity="0"
                            Tag="{x:Static Controls2:ResizeEdges.Top}" Margin="0,0,0,0" Height="6" Cursor="SizeNS" />
                    <Thumb HorizontalAlignment="Right" VerticalAlignment="Top" Opacity="0"
                            Tag="{x:Static Controls2:ResizeEdges.TopRight}" Margin="0,0,0,0" Height="8" Width="8"
                            Cursor="SizeNESW" />
                    <Thumb HorizontalAlignment="Left" VerticalAlignment="Top" Opacity="0"
                            Tag="{x:Static Controls2:ResizeEdges.TopLeft}" Margin="0,0,0,0" Height="8" Width="8"
                            Cursor="SizeNWSE" />
                </Grid>

                <Grid>
                    <AdornerDecorator>
                        <ContentPresenter ClipToBounds="True" Margin="{TemplateBinding Margin}" />
                    </AdornerDecorator>

                    <Thumb HorizontalAlignment="Right" VerticalAlignment="Stretch" Opacity="0"
                            Tag="{x:Static Controls2:ResizeEdges.Right}" Margin="0,0,0,0" Width="6" Cursor="SizeWE" />
                    <Thumb HorizontalAlignment="Left" VerticalAlignment="Stretch" Opacity="0"
                            Tag="{x:Static Controls2:ResizeEdges.Left}" Margin="0,0,0,0" Width="6" Cursor="SizeWE" />
                    <Thumb HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Opacity="0"
                            Tag="{x:Static Controls2:ResizeEdges.Bottom}" Margin="0,0,0,0" Height="6" Cursor="SizeNS" />
                    <Thumb HorizontalAlignment="Left" VerticalAlignment="Bottom" Opacity="0"
                            Tag="{x:Static Controls2:ResizeEdges.BottomLeft}" Margin="0,0,0,0" Height="8" Width="8"
                            Cursor="SizeNESW" />
                    <Thumb HorizontalAlignment="Right" VerticalAlignment="Bottom" Opacity="0"
                            Tag="{x:Static Controls2:ResizeEdges.BottomRight}" Margin="0,0,0,0" Height="8" Width="8"
                            Cursor="SizeNWSE" />
                </Grid>
            </DockPanel>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="IconImage" Property="Visibility" Value="Collapsed" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate TargetType="{x:Type Controls2:ChromeWindow}" x:Key="MaximizedWindowWithChromeKey">
        <Border Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}"
                CornerRadius="0">

            <DockPanel>
                <Grid DockPanel.Dock="Top" Height="30" VerticalAlignment="Top">

                    <Rectangle Stretch="Fill" Fill="{StaticResource UpperChromeRectangleColorKey}" Margin="0,0,0,0"
                            Height="15" VerticalAlignment="Top" />
                    <Rectangle Stretch="Fill" Fill="{StaticResource LowerChromeRectangleColorKey}" Margin="0,0,0,0"
                            Height="15" VerticalAlignment="Bottom" />
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
                        <Image x:Name="IconImage" Source="{TemplateBinding Icon}" Width="16" Height="16"
                                Margin="5,0,0,0" />
                        <Label Content="{TemplateBinding Title}" Foreground="{StaticResource ChromeTitleColorKey}"
                                FontWeight="Bold" />
                    </StackPanel>
                    <Thumb Opacity="0" x:Name="PART_ChromeThumb" />

                    <Button x:Name="PART_Minimize" Style="{StaticResource MinimizeButtonKey}" Margin="0,0,50,0"
                            Width="16" Height="16" HorizontalAlignment="Right" />
                    <Button x:Name="PART_Maximize" Style="{StaticResource MaximizeButtonKey}" Margin="0,0,30,0"
                            Width="16" Height="16" HorizontalAlignment="Right" />
                    <Button x:Name="PART_Close" Style="{StaticResource CloseButtonKey}" Margin="0,0,10,0" Width="16"
                            Height="16" HorizontalAlignment="Right" />
                </Grid>

                <Grid>
                    <AdornerDecorator>
                        <ContentPresenter ClipToBounds="True" Margin="{TemplateBinding Margin}"/>
                    </AdornerDecorator>
                </Grid>
            </DockPanel>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="IconImage" Property="Visibility" Value="Collapsed" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate TargetType="{x:Type Controls2:ChromeWindow}" x:Key="WindowWithoutChromeKey">
        <Border Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}"
                CornerRadius="{TemplateBinding BorderCornerRadius}">

            <AdornerDecorator>
                <ContentPresenter Margin="{TemplateBinding Margin}" />
            </AdornerDecorator>
        </Border>
    </ControlTemplate>

    <Style TargetType="{x:Type Controls2:ChromeWindow}">
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
        <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
        <Setter Property="MinHeight" Value="30" />
        <Setter Property="MinWidth" Value="150" />
        <Setter Property="UseLayoutRounding" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls2:ChromeWindow}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="{TemplateBinding BorderCornerRadius}">

                        <AdornerDecorator>
                            <ContentPresenter Margin="{TemplateBinding Margin}" />
                        </AdornerDecorator>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="ChromeWindowStyle" Value="None" />
                </MultiTrigger.Conditions>
                <Setter Property="Template" Value="{StaticResource WindowWithChromeNoneKey}" />
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="ChromeWindowStyle" Value="Single" />
                </MultiTrigger.Conditions>
                <Setter Property="Template" Value="{StaticResource WindowWithChromeKey}" />
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="ChromeWindowStyle" Value="Normal" />
                </MultiTrigger.Conditions>
                <Setter Property="Template" Value="{StaticResource ResizableWindowWithChromeKey}" />
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="WindowState" Value="Maximized" />
                    <Condition Property="IsFullScreen" Value="False" />
                </MultiTrigger.Conditions>
                <Setter Property="Template" Value="{StaticResource MaximizedWindowWithChromeKey}" />
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="ChromeWindowStyle" Value="NoChrome" />
                </MultiTrigger.Conditions>
                <Setter Property="Template" Value="{StaticResource WindowWithoutChromeKey}" />
            </MultiTrigger>
            <Trigger Property="IsFullScreen" Value="True">
                <Setter Property="BorderThickness" Value="1" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <!--NUMERIC SPINNER-->
    <LinearGradientBrush x:Key="PageGlassyBackground" StartPoint="0,0.5" EndPoint="1,0.5">
        <GradientBrush.GradientStops>
            <GradientStop Color="#ff2B6680" Offset="1.5" />
            <GradientStop Color="#569dc2" Offset="0" />
        </GradientBrush.GradientStops>
    </LinearGradientBrush>

    <!-- Focus background -->
    <LinearGradientBrush x:Key="GlassyBackground" StartPoint="0,0" EndPoint="0,1">
        <LinearGradientBrush.GradientStops>
            <GradientStop Color="#60FFFFFF" Offset="0" />
            <GradientStop Color="#30FFFFFF" Offset="0.4" />
            <GradientStop Color="#20FFFFFF" Offset="0.7" />
            <GradientStop Color="#40FFFFFF" Offset="1" />
        </LinearGradientBrush.GradientStops>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="GlassyBorder" StartPoint="0,0" EndPoint="0,1">
        <LinearGradientBrush.GradientStops>
            <GradientStop Color="#E0FFFFFF" Offset="0" />
            <GradientStop Color="#80FFFFFF" Offset="0.4" />
            <GradientStop Color="#70FFFFFF" Offset="0.8" />
            <GradientStop Color="#90FFFFFF" Offset="1" />
        </LinearGradientBrush.GradientStops>
    </LinearGradientBrush>

    <Style x:Key="numericButtonStyle" TargetType="{x:Type ButtonBase}">
        <Setter Property="Background" Value="#10FFFFFF" />
        <Setter Property="BorderBrush" Value="#40FFFFFF" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Padding" Value="2" />
        <Setter Property="Margin" Value="2" />
        <Setter Property="FontFamily" Value="Segoe SemiBold" />
        <Setter Property="FontSize" Value="28" />
        <Setter Property="Foreground" Value="White" />
        <Setter Property="Width" Value="24" />
        <Setter Property="Height" Value="24" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ButtonBase}">
                    <Border x:Name="Border" Padding="{TemplateBinding Padding}" CornerRadius="2"
                            Background="{TemplateBinding Background}" BorderThickness="2"
                            BorderBrush="{TemplateBinding BorderBrush}">
                        <Canvas>
                            <ContentPresenter />
                        </Canvas>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Border" Property="BorderBrush" Value="#B0FFFFFF" />
                        </Trigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter TargetName="Border" Property="Background" Value="{StaticResource GlassyBackground}" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource GlassyBorder}" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="Border" Property="Background" Value="#10FFFFFF" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="#40FFFFFF" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="#40FFFFFF" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate TargetType="{x:Type Controls2:NumericSpinner}" x:Key="EditableNumericSpinner">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"
                    CornerRadius="3">
                <Controls2:RegexTextBox x:Name="EditableRegexTextBox" BorderThickness="0"
                        Background="{TemplateBinding Background}" RegularExpression="^[0-9]*$"
                        TextBlock.Foreground="{TemplateBinding Foreground}"
                        Text="{Binding Value, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, Converter={StaticResource numericSpinnerValueConverter}}"
                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
            </Border>
            <Viewbox Grid.Column="1">
                <RepeatButton x:Name="PART_DecreaseButton" Style="{StaticResource numericButtonStyle}"
                        Command="Controls2:NumericSpinner.DecreaseCommand">
                    <Path Data="M 4,8 L 12,8" Stroke="{Binding Foreground,ElementName=PART_DecreaseButton}"
                            StrokeThickness="2" />
                </RepeatButton>
            </Viewbox>
            <Viewbox Grid.Column="2">
                <RepeatButton x:Name="PART_IncreaseButton" Style="{StaticResource numericButtonStyle}"
                        Command="Controls2:NumericSpinner.IncreaseCommand">
                    <Path Data="M 4,8 L 12,8 M 8,4 L 8,12" Stroke="{Binding Foreground,ElementName=PART_IncreaseButton}"
                            StrokeThickness="2" />
                </RepeatButton>
            </Viewbox>
        </Grid>

        <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                <Setter Property="BorderBrush" Value="{DynamicResource NumericSpinnerDisabledBorder}" />
                <Setter Property="Background" Value="{DynamicResource NumericSpinnerDisabledBackground}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="{x:Type Controls2:NumericSpinner}" TargetType="{x:Type Controls2:NumericSpinner}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="BorderBrush" Value="{DynamicResource NumericSpinnerBorder}" />
        <Setter Property="Background" Value="{DynamicResource NumericSpinnerBackground}" />
        <Setter Property="Foreground" Value="{DynamicResource NumericSpinnerForeground}" />
        <Setter Property="Padding" Value="1" />
        <Setter Property="FontFamily" Value="Segoe SemiBold" />
        <Setter Property="FontSize" Value="{DynamicResource {x:Static SystemFonts.MessageFontSizeKey}}" />
        <Setter Property="FontStyle" Value="{DynamicResource {x:Static SystemFonts.MessageFontStyleKey}}" />
        <Setter Property="FontWeight" Value="{DynamicResource {x:Static SystemFonts.MessageFontWeightKey}}" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls2:NumericSpinner}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"
                                CornerRadius="3">
                            <ContentControl Focusable="false"
                                    DataContext="{Binding Value, RelativeSource={RelativeSource TemplatedParent}}"
                                    Content="{Binding}" ContentTemplate="{TemplateBinding ValueTemplate}"
                                    ContentTemplateSelector="{TemplateBinding ValueTemplateSelector}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
                        </Border>
                        <Viewbox Grid.Column="1">
                            <RepeatButton x:Name="PART_DecreaseButton" Style="{StaticResource numericButtonStyle}"
                                    Command="Controls2:NumericSpinner.DecreaseCommand">
                                <Path Data="M 4,8 L 12,8" Stroke="{Binding Foreground,ElementName=PART_DecreaseButton}"
                                        StrokeThickness="2" />
                            </RepeatButton>
                        </Viewbox>
                        <Viewbox Grid.Column="2">
                            <RepeatButton x:Name="PART_IncreaseButton" Style="{StaticResource numericButtonStyle}"
                                    Command="Controls2:NumericSpinner.IncreaseCommand">
                                <Path Data="M 4,8 L 12,8 M 8,4 L 8,12"
                                        Stroke="{Binding Foreground,ElementName=PART_IncreaseButton}"
                                        StrokeThickness="2" />
                            </RepeatButton>
                        </Viewbox>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsEditable" Value="True">
                <Setter Property="Template" Value="{StaticResource EditableNumericSpinner}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <!-- CLOSEABLE TAB ITEM -->
    <Style x:Key="TabItemFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle SnapsToDevicePixels="true" Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1"
                            Margin="3,3,3,1" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <SolidColorBrush x:Key="TabItemHotBorderBrush" Color="#3C7FB1" />
    <SolidColorBrush x:Key="TabItemDisabledBackground" Color="#F4F4F4" />
    <SolidColorBrush x:Key="TabItemDisabledBorderBrush" Color="#FFC9C7BA" />

    <Style TargetType="{x:Type Controls2:CloseableTabItem}">
        <Style.Resources>
            <SolidColorBrush x:Key="ButtonNormalBackground" Color="Transparent" />
            <SolidColorBrush x:Key="ButtonOverBackground" Color="Transparent" />
            <SolidColorBrush x:Key="ButtonPressedBackground" Color="Transparent" />

            <SolidColorBrush x:Key="ButtonNormalBorder" Color="Transparent" />
            <Style x:Key="CloseableTabItemButtonStyle" TargetType="{x:Type Button}">
                <Setter Property="FocusVisualStyle" Value="{x:Null}" />
                <Setter Property="Background" Value="{StaticResource ButtonNormalBackground}" />
                <Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}" />
                <Setter Property="BorderThickness" Value="1" />
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
                <Setter Property="HorizontalContentAlignment" Value="Center" />
                <Setter Property="VerticalContentAlignment" Value="Center" />
                <Setter Property="Padding" Value="4" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Button}">
                            <Grid>
                                <Border SnapsToDevicePixels="true" x:Name="Chrome"
                                        Background="{TemplateBinding Background}"
                                        BorderBrush="{TemplateBinding BorderBrush}"
                                        BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2" Opacity="0" />
                                <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                        Margin="{TemplateBinding Padding}"
                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                        RecognizesAccessKey="True" />
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Opacity" TargetName="Chrome" Value="1" />
                                    <Setter Property="Background" TargetName="Chrome"
                                            Value="{DynamicResource ButtonOverBackground}" />
                                </Trigger>
                                <Trigger Property="IsPressed" Value="True">
                                    <Setter Property="Opacity" TargetName="Chrome" Value="1" />
                                    <Setter Property="Background" TargetName="Chrome"
                                            Value="{DynamicResource ButtonPressedBackground}" />
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="false">
                                    <Setter Property="Foreground" Value="#ADADAD" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Style.Resources>
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Foreground" Value="{DynamicResource TabItemForeground}" />
        <Setter Property="Padding" Value="6,1,6,1" />
        <Setter Property="Background" Value="{StaticResource ButtonNormalBackground}" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls2:CloseableTabItem}">
                    <Grid SnapsToDevicePixels="true">
                        <Border x:Name="Bd" Margin="0,0,3,3" Background="{DynamicResource TabItemBackground}"
                                BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0" CornerRadius="4">
                            <DockPanel x:Name="ContentPanel">
                                <Button x:Name="PART_Close" HorizontalAlignment="Center" Margin="3,0,3,0"
                                        VerticalAlignment="Center" Width="16" Height="16" DockPanel.Dock="Right"
                                        Style="{DynamicResource CloseableTabItemButtonStyle}" ToolTip="Close Tab">
                                    <Path x:Name="Path" Stretch="Fill" StrokeThickness="0.5" Stroke="#FF333333"
                                            Fill="#FF969696"
                                            Data="F1 M 2.28484e-007,1.33331L 1.33333,0L 4.00001,2.66669L 6.66667,6.10352e-005L 8,1.33331L 5.33334,4L 8,6.66669L 6.66667,8L 4,5.33331L 1.33333,8L 1.086e-007,6.66669L 2.66667,4L 2.28484e-007,1.33331 Z "
                                            HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
                                </Button>
                                <ContentPresenter x:Name="Content"
                                        SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                        ContentSource="Header" RecognizesAccessKey="True" HorizontalAlignment="Center"
                                        VerticalAlignment="Center" Margin="{TemplateBinding Padding}" />
                            </DockPanel>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" SourceName="PART_Close" Value="True">
                            <Setter Property="Fill" TargetName="Path" Value="#FFB83C3D" />
                        </Trigger>
                        <Trigger Property="IsPressed" SourceName="PART_Close" Value="True">
                            <Setter Property="Fill" TargetName="Path" Value="#FF9D3838" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource TabItemHotBackground}" />
                        </Trigger>
                        <Trigger Property="IsSelected" Value="true">
                            <Setter Property="Panel.ZIndex" Value="1" />
                            <Setter Property="Background" TargetName="Bd"
                                    Value="{DynamicResource TabItemSelectedBackground}" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="false" />
                                <Condition Property="IsMouseOver" Value="true" />
                            </MultiTrigger.Conditions>
                            <Setter Property="BorderBrush" TargetName="Bd"
                                    Value="{StaticResource TabItemHotBorderBrush}" />
                        </MultiTrigger>
                        <Trigger Property="TabStripPlacement" Value="Bottom">
                            <Setter Property="BorderThickness" TargetName="Bd" Value="1,0,1,1" />
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Left">
                            <Setter Property="BorderThickness" TargetName="Bd" Value="1,1,0,1" />
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Right">
                            <Setter Property="BorderThickness" TargetName="Bd" Value="0,1,1,1" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="true" />
                                <Condition Property="TabStripPlacement" Value="Top" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Margin" Value="-2,-2,-2,-1" />
                            <Setter Property="Margin" TargetName="ContentPanel" Value="0,0,0,1" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="true" />
                                <Condition Property="TabStripPlacement" Value="Bottom" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Margin" Value="-2,-1,-2,-2" />
                            <Setter Property="Margin" TargetName="ContentPanel" Value="0,1,0,0" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="true" />
                                <Condition Property="TabStripPlacement" Value="Left" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Margin" Value="-2,-2,-1,-2" />
                            <Setter Property="Margin" TargetName="ContentPanel" Value="0,0,1,0" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="true" />
                                <Condition Property="TabStripPlacement" Value="Right" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Margin" Value="-1,-2,-2,-2" />
                            <Setter Property="Margin" TargetName="ContentPanel" Value="1,0,0,0" />
                        </MultiTrigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Background" TargetName="Bd"
                                    Value="{StaticResource TabItemDisabledBackground}" />
                            <Setter Property="BorderBrush" TargetName="Bd"
                                    Value="{StaticResource TabItemDisabledBorderBrush}" />
                            <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--TAB MENU-->
    <Style x:Key="{x:Type Controls2:TabMenu}" TargetType="{x:Type Controls2:TabMenu}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls2:TabMenu}">
                    <Grid ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition x:Name="ColumnDefinition0" />
                            <ColumnDefinition x:Name="ColumnDefinition1" Width="0" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition x:Name="RowDefinition0" Height="Auto">
                            </RowDefinition>
                            <RowDefinition x:Name="RowDefinition1" Height="*" />
                        </Grid.RowDefinitions>
                        <TabPanel Margin="2,2,2,0" x:Name="HeaderPanel" Grid.Column="0" Grid.Row="0" IsItemsHost="true"
                                Panel.ZIndex="1" KeyboardNavigation.TabIndex="1">
                            <TabPanel.ContextMenu>
                                <ContextMenu>
                                    <MenuItem Header="{DynamicResource closeString}" Command="{x:Static Controls2:TabMenu.CloseCommand}" />
                                    <MenuItem Header="{DynamicResource closeAllString}" Command="{x:Static Controls2:TabMenu.CloseAllCommand}" />
                                    <MenuItem Header="{DynamicResource closeAllButThisString}" Command="{x:Static Controls2:TabMenu.CloseAllButThisCommand}"  />
                                </ContextMenu>
                            </TabPanel.ContextMenu>
                        </TabPanel>
                        <Border x:Name="ContentPanel" Grid.Column="0" Grid.Row="1"
                                Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                KeyboardNavigation.DirectionalNavigation="Contained" KeyboardNavigation.TabIndex="2"
                                KeyboardNavigation.TabNavigation="Local" CornerRadius="{TemplateBinding CornerRadius}">
                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                    Margin="{TemplateBinding Padding}" x:Name="PART_SelectedContentHost"
                                    ContentSource="SelectedContent" />
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="TabStripPlacement" Value="Bottom">
                            <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="1" />
                            <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0" />
                            <Setter Property="Height" TargetName="RowDefinition0" Value="*" />
                            <Setter Property="Height" TargetName="RowDefinition1" Value="Auto" />
                            <Setter Property="Margin" TargetName="HeaderPanel" Value="2,0,2,2" />
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Left">
                            <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="0" />
                            <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0" />
                            <Setter Property="Grid.Column" TargetName="HeaderPanel" Value="0" />
                            <Setter Property="Grid.Column" TargetName="ContentPanel" Value="1" />
                            <Setter Property="Width" TargetName="ColumnDefinition0" Value="Auto" />
                            <Setter Property="Width" TargetName="ColumnDefinition1" Value="*" />
                            <Setter Property="Height" TargetName="RowDefinition0" Value="*" />
                            <Setter Property="Height" TargetName="RowDefinition1" Value="0" />
                            <Setter Property="Margin" TargetName="HeaderPanel" Value="2,2,0,2" />
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Right">
                            <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="0" />
                            <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0" />
                            <Setter Property="Grid.Column" TargetName="HeaderPanel" Value="1" />
                            <Setter Property="Grid.Column" TargetName="ContentPanel" Value="0" />
                            <Setter Property="Width" TargetName="ColumnDefinition0" Value="*" />
                            <Setter Property="Width" TargetName="ColumnDefinition1" Value="Auto" />
                            <Setter Property="Height" TargetName="RowDefinition0" Value="*" />
                            <Setter Property="Height" TargetName="RowDefinition1" Value="0" />
                            <Setter Property="Margin" TargetName="HeaderPanel" Value="0,2,2,2" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="HasItems" Value="False">
                <Setter Property="Visibility" Value="Collapsed" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <!-- TAB MENU ITEM -->
    <Style BasedOn="{StaticResource {x:Type Button}}" TargetType="Button" x:Key="DetachButtonKey">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">

                    <Grid x:Name="grid" RenderTransformOrigin="0.5, 0.5">
                        <Grid.RenderTransform>
                            <ScaleTransform ScaleX="1" ScaleY="1" />
                        </Grid.RenderTransform>
                        <Image x:Name="image">
                            <Image.Source>
                                <DrawingImage>
                                    <DrawingImage.Drawing>
                                        <DrawingGroup>
                                            <DrawingGroup.Children>
                                                <GeometryDrawing Brush="#FF464646" Geometry="F1 M 80,5L 346,5C 387.421,5 421,38.5786 421,80L 421,346C 421,387.421 387.421,421 346,421L 80,421C 38.5786,421 5,387.421 5,346L 5,80C 5,38.5786 38.5786,5 80,5 Z ">
                                                    <GeometryDrawing.Pen>
                                                        <Pen Thickness="10" LineJoin="Round" Brush="#FF000000"/>
                                                    </GeometryDrawing.Pen>
                                                </GeometryDrawing>
                                                <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 357,69L 69,357">
                                                    <GeometryDrawing.Pen>
                                                        <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                    </GeometryDrawing.Pen>
                                                </GeometryDrawing>
                                                <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 197,101L 357,69">
                                                    <GeometryDrawing.Pen>
                                                        <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                    </GeometryDrawing.Pen>
                                                </GeometryDrawing>
                                                <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 325,229L 357,69">
                                                    <GeometryDrawing.Pen>
                                                        <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                    </GeometryDrawing.Pen>
                                                </GeometryDrawing>
                                            </DrawingGroup.Children>
                                        </DrawingGroup>
                                    </DrawingImage.Drawing>
                                </DrawingImage>
                            </Image.Source>
                        </Image>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="1.1" Duration="00:00:00.1" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="1.1" Duration="00:00:00.1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="1.0" Duration="00:00:00.1" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="1.0" Duration="00:00:00.1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>

                            <Setter TargetName="image" Property="Source">
                                <Setter.Value>
                                    <DrawingImage>
                                        <DrawingImage.Drawing>
                                            <DrawingGroup>
                                                <DrawingGroup.Children>
                                                    <GeometryDrawing Brush="#FF545353" Geometry="F1 M 80,5L 346,5C 387.421,5 421,38.5786 421,80L 421,346C 421,387.421 387.421,421 346,421L 80,421C 38.5786,421 5,387.421 5,346L 5,80C 5,38.5786 38.5786,5 80,5 Z ">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="10" LineJoin="Round" Brush="#FF000000"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 357,69L 69,357">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 197,101L 357,69">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 325,229L 357,69">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                </DrawingGroup.Children>
                                            </DrawingGroup>
                                        </DrawingImage.Drawing>
                                    </DrawingImage>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">

                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="0.9" Duration="00:00:00.1" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="0.9" Duration="00:00:00.1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="1.0" Duration="00:00:00.1" FillBehavior="Stop" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="1.0" Duration="00:00:00.1" FillBehavior="Stop" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>

                            <Setter TargetName="image" Property="Source">
                                <Setter.Value>
                                    <DrawingImage>
                                        <DrawingImage.Drawing>
                                            <DrawingGroup>
                                                <DrawingGroup.Children>
                                                    <GeometryDrawing Brush="#FF212020" Geometry="F1 M 80,5L 346,5C 387.421,5 421,38.5786 421,80L 421,346C 421,387.421 387.421,421 346,421L 80,421C 38.5786,421 5,387.421 5,346L 5,80C 5,38.5786 38.5786,5 80,5 Z ">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="10" LineJoin="Round" Brush="#FF000000"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 357,69L 69,357">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 197,101L 357,69">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 325,229L 357,69">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                </DrawingGroup.Children>
                                            </DrawingGroup>
                                        </DrawingImage.Drawing>
                                    </DrawingImage>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style BasedOn="{StaticResource {x:Type Button}}" TargetType="Button" x:Key="AttachButtonKey">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">

                    <Grid x:Name="grid" RenderTransformOrigin="0.5, 0.5">
                        <Grid.RenderTransform>
                            <ScaleTransform ScaleX="1" ScaleY="1" />
                        </Grid.RenderTransform>
                        <Image x:Name="image">
                            <Image.Source>
                                <DrawingImage>
                                    <DrawingImage.Drawing>
                                        <DrawingGroup>
                                            <DrawingGroup.Children>
                                                <GeometryDrawing Brush="#FF464646" Geometry="F1 M 346,421L 80,421C 38.5786,421 5,387.421 5,346L 5,80C 5,38.5787 38.5786,5 80,5L 346,5C 387.421,5 421,38.5787 421,80L 421,346C 421,387.421 387.421,421 346,421 Z ">
                                                    <GeometryDrawing.Pen>
                                                        <Pen Thickness="10" LineJoin="Round" Brush="#FF000000"/>
                                                    </GeometryDrawing.Pen>
                                                </GeometryDrawing>
                                                <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 68.9999,357L 357,69">
                                                    <GeometryDrawing.Pen>
                                                        <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                    </GeometryDrawing.Pen>
                                                </GeometryDrawing>
                                                <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 229,325L 68.9999,357">
                                                    <GeometryDrawing.Pen>
                                                        <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                    </GeometryDrawing.Pen>
                                                </GeometryDrawing>
                                                <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 101,197L 68.9999,357">
                                                    <GeometryDrawing.Pen>
                                                        <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                    </GeometryDrawing.Pen>
                                                </GeometryDrawing>
                                            </DrawingGroup.Children>
                                        </DrawingGroup>
                                    </DrawingImage.Drawing>
                                </DrawingImage>
                            </Image.Source>
                        </Image>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="1.1" Duration="00:00:00.1" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="1.1" Duration="00:00:00.1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="1.0" Duration="00:00:00.1" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="1.0" Duration="00:00:00.1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>

                            <Setter TargetName="image" Property="Source">
                                <Setter.Value>
                                    <DrawingImage>
                                        <DrawingImage.Drawing>
                                            <DrawingGroup>
                                                <DrawingGroup.Children>
                                                    <GeometryDrawing Brush="#FF545353" Geometry="F1 M 346,421L 80,421C 38.5786,421 5,387.421 5,346L 5,80C 5,38.5787 38.5786,5 80,5L 346,5C 387.421,5 421,38.5787 421,80L 421,346C 421,387.421 387.421,421 346,421 Z ">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="10" LineJoin="Round" Brush="#FF000000"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 68.9999,357L 357,69">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 229,325L 68.9999,357">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 101,197L 68.9999,357">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                </DrawingGroup.Children>
                                            </DrawingGroup>
                                        </DrawingImage.Drawing>
                                    </DrawingImage>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">

                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="0.9" Duration="00:00:00.1" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="0.9" Duration="00:00:00.1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="1.0" Duration="00:00:00.1" FillBehavior="Stop" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="1.0" Duration="00:00:00.1" FillBehavior="Stop" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>

                            <Setter TargetName="image" Property="Source">
                                <Setter.Value>
                                    <DrawingImage>
                                        <DrawingImage.Drawing>
                                            <DrawingGroup>
                                                <DrawingGroup.Children>
                                                    <GeometryDrawing Brush="#FF212020" Geometry="F1 M 346,421L 80,421C 38.5786,421 5,387.421 5,346L 5,80C 5,38.5787 38.5786,5 80,5L 346,5C 387.421,5 421,38.5787 421,80L 421,346C 421,387.421 387.421,421 346,421 Z ">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="10" LineJoin="Round" Brush="#FF000000"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 68.9999,357L 357,69">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 229,325L 68.9999,357">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 101,197L 68.9999,357">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                </DrawingGroup.Children>
                                            </DrawingGroup>
                                        </DrawingImage.Drawing>
                                    </DrawingImage>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style BasedOn="{StaticResource {x:Type Button}}" TargetType="Button" x:Key="SmallCloseButtonKey">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">

                    <Grid x:Name="grid" RenderTransformOrigin="0.5, 0.5">
                        <Grid.RenderTransform>
                            <ScaleTransform ScaleX="1" ScaleY="1" />
                        </Grid.RenderTransform>
                        <Image x:Name="image">
                            <Image.Source>
                                <DrawingImage>
                                    <DrawingImage.Drawing>
                                        <DrawingGroup>
                                            <DrawingGroup.Children>
                                                <GeometryDrawing Brush="#FF464646" Geometry="F1 M 80,5.00006L 346,5.00006C 387.421,5.00006 421,38.5787 421,80L 421,346C 421,387.421 387.421,421 346,421L 80,421C 38.5786,421 5,387.421 5,346L 5,80C 5,38.5787 38.5786,5.00006 80,5.00006 Z ">
                                                    <GeometryDrawing.Pen>
                                                        <Pen Thickness="10" LineJoin="Round" Brush="#FF000000"/>
                                                    </GeometryDrawing.Pen>
                                                </GeometryDrawing>
                                                <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 101,101L 325,325">
                                                    <GeometryDrawing.Pen>
                                                        <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                    </GeometryDrawing.Pen>
                                                </GeometryDrawing>
                                                <GeometryDrawing Brush="#FFEF1414" Geometry="F1 M 101,325L 325,101">
                                                    <GeometryDrawing.Pen>
                                                        <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                    </GeometryDrawing.Pen>
                                                </GeometryDrawing>
                                            </DrawingGroup.Children>
                                        </DrawingGroup>
                                    </DrawingImage.Drawing>
                                </DrawingImage>
                            </Image.Source>
                        </Image>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="1.1" Duration="00:00:00.1" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="1.1" Duration="00:00:00.1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="1.0" Duration="00:00:00.1" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="1.0" Duration="00:00:00.1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>

                            <Setter TargetName="image" Property="Source">
                                <Setter.Value>
                                    <DrawingImage>
                                        <DrawingImage.Drawing>
                                            <DrawingGroup>
                                                <DrawingGroup.Children>
                                                    <GeometryDrawing Brush="#FFBD0000" Geometry="F1 M 80,5.00006L 346,5.00006C 387.421,5.00006 421,38.5787 421,80L 421,346C 421,387.421 387.421,421 346,421L 80,421C 38.5786,421 5,387.421 5,346L 5,80C 5,38.5787 38.5786,5.00006 80,5.00006 Z ">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="10" LineJoin="Round" Brush="#FF000000"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 101,101L 325,325">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FFEF1414" Geometry="F1 M 101,325L 325,101">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                </DrawingGroup.Children>
                                            </DrawingGroup>
                                        </DrawingImage.Drawing>
                                    </DrawingImage>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">

                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="0.9" Duration="00:00:00.1" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="0.9" Duration="00:00:00.1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
                                            To="1.0" Duration="00:00:00.1" FillBehavior="Stop" />

                                        <DoubleAnimation
                                            Storyboard.TargetName="grid"
                                            Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
                                            To="1.0" Duration="00:00:00.1" FillBehavior="Stop" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>

                            <Setter TargetName="image" Property="Source">
                                <Setter.Value>
                                    <DrawingImage>
                                        <DrawingImage.Drawing>
                                            <DrawingGroup>
                                                <DrawingGroup.Children>
                                                    <GeometryDrawing Brush="#FFAA0000" Geometry="F1 M 80,5.00006L 346,5.00006C 387.421,5.00006 421,38.5787 421,80L 421,346C 421,387.421 387.421,421 346,421L 80,421C 38.5786,421 5,387.421 5,346L 5,80C 5,38.5787 38.5786,5.00006 80,5.00006 Z ">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="10" LineJoin="Round" Brush="#FF000000"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 101,101L 325,325">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="#FFEF1414" Geometry="F1 M 101,325L 325,101">
                                                        <GeometryDrawing.Pen>
                                                            <Pen Thickness="40" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" Brush="#FFFFFFFF"/>
                                                        </GeometryDrawing.Pen>
                                                    </GeometryDrawing>
                                                </DrawingGroup.Children>
                                            </DrawingGroup>
                                        </DrawingImage.Drawing>
                                    </DrawingImage>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type Controls2:TabMenuItemWindow}">
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
        <Setter Property="MinHeight" Value="30" />
        <Setter Property="MinWidth" Value="150" />
        <Setter Property="Margin" Value="3,5,3,5" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls2:TabMenuItemWindow}">
                    <Border Background="{DynamicResource MainWindowBackground}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="{TemplateBinding BorderCornerRadius}">

                        <DockPanel>
                            <Grid DockPanel.Dock="Top" Height="30" VerticalAlignment="Top">

                                <Rectangle Stretch="Fill" Fill="{StaticResource UpperChromeRectangleColorKey}"
                                        Margin="0,0,0,0" Height="15" VerticalAlignment="Top" />
                                <Rectangle Stretch="Fill" Fill="{StaticResource LowerChromeRectangleColorKey}"
                                        Margin="0,0,0,0" Height="15" VerticalAlignment="Bottom" />
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"
                                        VerticalAlignment="Center">
                                    <Label Content="{TemplateBinding Header}"
                                            Foreground="{StaticResource ChromeTitleColorKey}" FontWeight="Bold" />
                                </StackPanel>
                                <Thumb Opacity="0" x:Name="PART_ChromeThumb" />

                                <DockPanel>
                                    <Button x:Name="PART_Close" DockPanel.Dock="Right"
                                            Style="{StaticResource CloseButtonKey}" Margin="0,0,4,0" Width="16"
                                            Height="16" HorizontalAlignment="Right" />
                                    <Button x:Name="PART_Attach" DockPanel.Dock="Right"
                                            Style="{StaticResource AttachButtonKey}" Margin="0,0,4,0" Width="16"
                                            Height="16" HorizontalAlignment="Right" />
                                </DockPanel>

                                <Thumb HorizontalAlignment="Right" VerticalAlignment="Stretch" Opacity="0"
                                        Tag="{x:Static Controls2:ResizeEdges.Right}" Margin="0,0,0,0" Width="6"
                                        Cursor="SizeWE" />
                                <Thumb HorizontalAlignment="Left" VerticalAlignment="Stretch" Opacity="0"
                                        Tag="{x:Static Controls2:ResizeEdges.Left}" Margin="0,0,0,0" Width="6"
                                        Cursor="SizeWE" />
                                <Thumb HorizontalAlignment="Stretch" VerticalAlignment="Top" Opacity="0"
                                        Tag="{x:Static Controls2:ResizeEdges.Top}" Margin="0,0,0,0" Height="6"
                                        Cursor="SizeNS" />
                                <Thumb HorizontalAlignment="Right" VerticalAlignment="Top" Opacity="0"
                                        Tag="{x:Static Controls2:ResizeEdges.TopRight}" Margin="0,0,0,0" Height="8"
                                        Width="8" Cursor="SizeNESW" />
                                <Thumb HorizontalAlignment="Left" VerticalAlignment="Top" Opacity="0"
                                        Tag="{x:Static Controls2:ResizeEdges.TopLeft}" Margin="0,0,0,0" Height="8"
                                        Width="8" Cursor="SizeNWSE" />
                            </Grid>

                            <Grid>
                                <AdornerDecorator>
                                    <ContentPresenter Margin="{TemplateBinding Margin}" ClipToBounds="True" />
                                </AdornerDecorator>

                                <Thumb HorizontalAlignment="Right" VerticalAlignment="Stretch" Opacity="0"
                                        Tag="{x:Static Controls2:ResizeEdges.Right}" Margin="0,0,0,0" Width="6"
                                        Cursor="SizeWE" />
                                <Thumb HorizontalAlignment="Left" VerticalAlignment="Stretch" Opacity="0"
                                        Tag="{x:Static Controls2:ResizeEdges.Left}" Margin="0,0,0,0" Width="6"
                                        Cursor="SizeWE" />
                                <Thumb HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Opacity="0"
                                        Tag="{x:Static Controls2:ResizeEdges.Bottom}" Margin="0,0,0,0" Height="6"
                                        Cursor="SizeNS" />
                                <Thumb HorizontalAlignment="Left" VerticalAlignment="Bottom" Opacity="0"
                                        Tag="{x:Static Controls2:ResizeEdges.BottomLeft}" Margin="0,0,0,0" Height="8"
                                        Width="8" Cursor="SizeNESW" />
                                <Thumb HorizontalAlignment="Right" VerticalAlignment="Bottom" Opacity="0"
                                        Tag="{x:Static Controls2:ResizeEdges.BottomRight}" Margin="0,0,0,0" Height="8"
                                        Width="8" Cursor="SizeNWSE" />
                            </Grid>
                        </DockPanel>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsCloseButtonVisible" Value="False">
                            <Setter TargetName="PART_Close" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type Controls2:TabMenuItem}">
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Padding" Value="6,0,6,0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls2:TabMenuItem}">
                    <Grid>
                        <Border Name="Bd" Background="{TemplateBinding Background}"
                                BorderThickness="{TemplateBinding Background}"
                                CornerRadius="{TemplateBinding CornerRadius}" Margin="{TemplateBinding Margin}">
                            <DockPanel x:Name="ContentPanel">
                                <Button x:Name="PART_Close" HorizontalAlignment="Center" Margin="0,0,3,0"
                                        VerticalAlignment="Center" Width="10" Height="10" DockPanel.Dock="Right"
                                        Style="{StaticResource SmallCloseButtonKey}" />
                                <Button x:Name="PART_Detach" HorizontalAlignment="Center" Margin="0,0,3,0"
                                        VerticalAlignment="Center" Width="10" Height="10" DockPanel.Dock="Right"
                                        Style="{StaticResource DetachButtonKey}" />

                                <ContentPresenter x:Name="Content"
                                        SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                        ContentSource="Header" RecognizesAccessKey="True" HorizontalAlignment="Center"
                                        VerticalAlignment="Center" Margin="{TemplateBinding Padding}" />
                            </DockPanel>
                        </Border>
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsDetachable" Value="True">
                            <Setter TargetName="PART_Detach" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="IsDetachable" Value="False">
                            <Setter TargetName="PART_Detach" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                        <Trigger Property="IsCloseable" Value="True">
                            <Setter TargetName="PART_Close" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="IsCloseable" Value="False">
                            <Setter TargetName="PART_Close" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- ACCORDION CONTROL -->
    <Style x:Key="ExpanderDownHeaderStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="19" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Path x:Name="arrow" HorizontalAlignment="Center" VerticalAlignment="Center"
                                Stroke="{TemplateBinding Foreground}" StrokeThickness="2" SnapsToDevicePixels="false"
                                Data="M 1,1.5 L 4.5,5 L 8,1.5">
                        </Path>
                        <ContentPresenter Grid.Column="1" Margin="4,0,0,0" HorizontalAlignment="Left"
                                VerticalAlignment="Center" SnapsToDevicePixels="True" RecognizesAccessKey="True" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter Property="Data" Value="M 1,4.5  L 4.5,1  L 8,4.5" TargetName="arrow" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Path.BitmapEffect" TargetName="arrow">
                                <Setter.Value>
                                    <DropShadowBitmapEffect Color="White" ShadowDepth="1.0" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter Property="Path.BitmapEffect" TargetName="arrow">
                                <Setter.Value>
                                    <DropShadowBitmapEffect Color="White" ShadowDepth="1.5" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type Controls2:AccordionItem}">
        <Setter Property="BorderThickness" Value="4" />
        <Setter Property="Padding" Value="3" />
        <Setter Property="BorderBrush" Value="{DynamicResource AccordionBorderBrush}" />
        <Setter Property="Background" Value="{DynamicResource AccordionBackground}" />
        <Setter Property="Foreground" Value="{DynamicResource AccordionForeground}" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls2:AccordionItem}">
                    <Border CornerRadius="4" BorderBrush="{TemplateBinding BorderBrush}"
                            Background="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="False">
                        <DockPanel>
                            <ToggleButton x:Name="HeaderSite" Margin="-1" DockPanel.Dock="Top" MinWidth="0"
                                    MinHeight="14" Style="{StaticResource ExpanderDownHeaderStyle}" Focusable="False"
                                    IsChecked="{Binding Path=IsSelected, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                    Content="{TemplateBinding Header}"
                                    ContentTemplate="{TemplateBinding HeaderTemplate}"
                                    ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
                                    Foreground="{TemplateBinding Foreground}" Background="{TemplateBinding BorderBrush}"
                                    FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}"
                                    FontStyle="{TemplateBinding FontStyle}" FontStretch="{TemplateBinding FontStretch}"
                                    FontWeight="{TemplateBinding FontWeight}"
                                    HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />

                            <Border Margin="0,2,0,0" CornerRadius="4" Background="{TemplateBinding Background}"
                                    SnapsToDevicePixels="False">
                                <ContentPresenter x:Name="PART_ContentHost" Focusable="false" DockPanel.Dock="Bottom"
                                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                        Margin="{TemplateBinding Padding}" />
                            </Border>
                        </DockPanel>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type Controls2:AccordionControl}">
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls2:AccordionControl}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <ItemsPresenter x:Name="PART_ItemsPresenter" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type Controls2:AccordionSplitter}">
        <Setter Property="Background" Value="{DynamicResource AccordionSplitterBackground}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls2:AccordionSplitter}">
                    <Border Cursor="SizeNS" BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}" Height="3" HorizontalAlignment="Stretch" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- TIME PICKER -->
    <Style TargetType="{x:Type Controls2:TimePicker}">
        <Setter Property="MinWidth" Value="120" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls2:TimePicker}">
                    <!--Border that wraps the control-->
                    <Grid
                            DataContext="{Binding RelativeSource={RelativeSource AncestorType={x:Type Controls2:TimePicker}}}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="25" />
                            <ColumnDefinition Width="10" />
                            <ColumnDefinition Width="25" />
                            <ColumnDefinition Width="10" />
                            <ColumnDefinition Width="25" />
                            <ColumnDefinition Width="10" />
                            <ColumnDefinition Width="25" />
                            <ColumnDefinition Width="10" />
                            <ColumnDefinition Width="25" />
                            <ColumnDefinition Width="25" />
                        </Grid.ColumnDefinitions>

                        <Grid.Resources>
                            <!--Control template to remove the default style of the textblock-->
                            <Style TargetType="TextBlock">
                                <Setter Property="Foreground" Value="{Binding Foreground}" />
                                <Setter Property="FontWeight" Value="{Binding FontWeight}" />
                                <Setter Property="FontStyle" Value="{Binding FontStyle}" />
                                <Setter Property="FontStretch" Value="{Binding FontStretch}" />
                                <Setter Property="FontSize" Value="{Binding FontSize}" />
                                <Setter Property="FontFamily" Value="{Binding FontFamily}" />
                                <Setter Property="Margin" Value="0,0,0,2" />
                                <Setter Property="VerticalAlignment" Value="Center" />
                                <Setter Property="HorizontalAlignment" Value="Center" />
                            </Style>
                            <!--Control template to remove the default style of the textboxes-->
                            <Style TargetType="TextBox">
                                <!--Bind properties to use in the textboxes-->
                                <Setter Property="Foreground" Value="{Binding Foreground}" />
                                <Setter Property="FontWeight" Value="{Binding FontWeight}" />
                                <Setter Property="FontStyle" Value="{Binding FontStyle}" />
                                <Setter Property="FontStretch" Value="{Binding FontStretch}" />
                                <Setter Property="FontSize" Value="{Binding FontSize}" />
                                <Setter Property="FontFamily" Value="{Binding FontFamily}" />
                                <Setter Property="VerticalAlignment" Value="Stretch" />
                                <Setter Property="HorizontalAlignment" Value="Stretch" />
                                <Setter Property="VerticalContentAlignment" Value="Center" />
                                <Setter Property="Margin" Value="1 0 1 0" />
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="TextBox">
                                            <ScrollViewer Name="PART_ContentHost" />
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </Grid.Resources>

                        <!--Days text-->
                        <Border ToolTip="{DynamicResource dayString}"
                                Grid.Column="0" Background="{TemplateBinding Background}" CornerRadius="3"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                            <TextBox Name="PART_Days" Text="{Binding SelectedDay}" SnapsToDevicePixels="True" />
                        </Border>
                        <TextBlock Text="{DynamicResource abbDayString}" Grid.Column="1" />
                        <!--Hours text-->
                        <Border ToolTip="{DynamicResource hourString}"
                                Grid.Column="2" Background="{TemplateBinding Background}" CornerRadius="3"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                            <TextBox Name="PART_Hours" Text="{Binding SelectedHour}" SnapsToDevicePixels="True" />
                        </Border>
                        <TextBlock Text="{DynamicResource abbHourString}" Grid.Column="3" />
                        <!--Minutes text-->
                        <Border ToolTip="{DynamicResource minuteString}"
                                Grid.Column="4" Background="{TemplateBinding Background}" CornerRadius="3"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                            <TextBox Name="PART_Minutes" Text="{Binding SelectedMinute}" SnapsToDevicePixels="True" />
                        </Border>
                        <TextBlock Text="{DynamicResource abbMinuteString}" Grid.Column="5" />
                        <!--Seconds text-->
                        <Border ToolTip="{DynamicResource secondString}"
                                Grid.Column="6" Background="{TemplateBinding Background}" CornerRadius="3"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                            <TextBox Name="PART_Seconds" Text="{Binding SelectedSecond}" SnapsToDevicePixels="True" />
                        </Border>
                        <TextBlock Text="{DynamicResource abbSecondString}" Grid.Column="7" />
                        
                        <Viewbox Grid.Column="8">
                            <RepeatButton Name="PART_DecrementTime" Style="{StaticResource numericButtonStyle}">
                                <Path Data="M 4,8 L 12,8" Stroke="{Binding Foreground,ElementName=PART_DecrementTime}"
                                        StrokeThickness="2" />
                            </RepeatButton>
                        </Viewbox>
                        <Viewbox Grid.Column="9">
                            <RepeatButton Name="PART_IncreaseTime" Style="{StaticResource numericButtonStyle}">
                                <Path Data="M 4,8 L 12,8 M 8,4 L 8,12"
                                        Stroke="{Binding Foreground,ElementName=PART_IncreaseTime}" StrokeThickness="2" />
                            </RepeatButton>
                        </Viewbox>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>